package com.another.common.utils.base.controller;

/*
import com.jingchuang.com.another.exhibitioncommon.entity.dbsys.request.TMenuModel;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.RestController;
//import com.jingchuang.com.another.exhibitioncommon.utils.redis.RedisRepository;
import org.springframework.web.client.RestTemplate;
import org.springframework.cloud.client.ServiceInstance;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

*//**
 * Created by Another on 2017/8/8.
 *//*
@RestController
public class BaseController {
    @Autowired
    protected HttpServletRequest reques;
//    @Autowired
//    protected RedisRepository redisRepository;  //redis工具类 (新版)

    @Autowired
    private LoadBalancerClient loadBalancerClient;
    protected Logger logger=Logger.getLogger(this.getClass());

    @Autowired
    private RestTemplate restTemplate;
//
    // A已经是一个泛型类，其类型参数是T
    public  <T> List<T>  callService(String url, HttpMethod method,Class<T> param,T res ) {
        // 再在其中定义一个泛型方法，该方法的类型参数也是T
        ServiceInstance serviceInstance = loadBalancerClient.choose("eureka-client");
        List<String> s=new ArrayList<String>();
        List<T> response = restTemplate.exchange(url,
                method, new HttpEntity<>(param), new ParameterizedTypeReference<List<T>>() {}).getBody();
        return response;
    }
}*/
